package com.ebraga.trackerclub.android.view.receiver;

import java.util.Calendar;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;

import com.ebraga.trackerclub.android.util.SynchManager;

public class BootCompletedReceiver extends BroadcastReceiver {

	@Override
	public void onReceive(Context context, Intent intent) {

		if (intent.getAction().equals(Intent.ACTION_BOOT_COMPLETED) || 
				intent.getAction().equals("android.intent.action.QUICKBOOT_POWERON")) {
			// Start after 30 seconds, to make sure boot is completed
			Calendar cal = Calendar.getInstance();
			cal.add(Calendar.SECOND, 30);
			
			SynchManager.setRepeatingAlarmForSynch(context, cal.getTimeInMillis());
			//SynchManager.setRepeatingAlarmForPosition(context, cal.getTimeInMillis());

		}

	}

}